﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.ServiceModel.Web;
using PWMIS.DataMap.Entity;
using NBFDAL.SqlMapDAL;
using PlzdModel;

namespace PlzdServices
{
    // 注意: 如果更改此处的类名 "PlzdService"，也必须更新 Web.config 中对 "PlzdService" 的引用。
    public class PlzdService : IPlzdService
    {

        #region IPlzdService 成员
        //复杂的参数类型，不能使用Get方式。
        //[WebGet(BodyStyle = WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json)]
        [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, Method = "POST")]
        public List<PlzdModel.PFT_Customer> GetPlzdUserList(Dictionary<string, string> p)
        {
            PLZDUserInfo plzd = new PLZDUserInfo();
            List<PFT_Customer> curlsit = plzd.GetPlzdUserList();
            
            //PlzdModel.PFT_Customer curUser = new PlzdModel.PFT_Customer();
            //OQL query = OQL.From(curUser);
            //if (p.ContainsKey("UserMobile"))
            //    query.Select().Where(query.Condition.AND(curUser.Mobile, "=", p["UserMobile"]));
            //if (p.ContainsKey("UserName"))
            //    query.Select().Where(query.Condition.AND(curUser.CustomerName, " like ", "%" + p["UserName"] + "%"));
            //if (p.ContainsKey("UserEmail"))
            //    query.Select().Where(query.Condition.AND(curUser.CustomerName, " like ", "%" + p["UserName"] + "%"));
            //if (p.ContainsKey("UserAge"))
            //{
            //    if (p["UserAge"].Split('$').Length == 2)
            //    {
            //        query.Select().Where(query.Condition.AND(curUser.age, ">=", p["UserAge"].Split('$')[0]));
            //        query.Select().Where(query.Condition.AND(curUser.age, "<=", p["UserAge"].Split('$')[1]));
            //    }
            //}

            //if (query.Condition.Parameters.Count == 0)
            //    query.Select().Where(query.Condition.AND(curUser.ID, "=", "0"));

            //List<PlzdModel.PFT_Customer> curList = EntityQuery<PlzdModel.PFT_Customer>.QueryList(query);

            List<PFT_Customer> a = new List<PFT_Customer>();
            int m = 1;
            int n = 100000;
            int s = 1;
            //默认情况下，超过约 3000 条记录将失败
            for (int i = 0; i < curlsit.Count; i++)
            {
                if (m<i && i< n)
                    a.Add(curlsit[i]);
            }
            return a;
        
        }

        #endregion
    }
}
